//package com.iogogogo.supervisord4j.configuration;
//
//import com.iogogogo.supervisord.core.Supervisord;
//import com.iogogogo.supervisord.core.rpc.SupervisordRpc;
//import com.iogogogo.supervisord.properties.SupervisordProperties;
//import com.iogogogo.supervisord4j.properties.InstanceProperties;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.boot.context.properties.EnableConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.context.annotation.Primary;
//
///**
// * Created by tao.zeng on 2021/7/12.
// */
//@Slf4j
//@Configuration
//@EnableConfigurationProperties(value = InstanceProperties.class)
//public class InstanceConfiguration {
//
//    private final InstanceProperties instanceProperties;
//
//    public InstanceConfiguration(InstanceProperties instanceProperties) {
//        this.instanceProperties = instanceProperties;
//    }
//
//    @Primary
//    @Bean("instance1")
//    @ConditionalOnProperty(prefix = "supervisord.instance.instance1", value = "enable", matchIfMissing = true, havingValue = "true")
//    public Supervisord instance1() {
//        return new SupervisordRpc(instanceProperties.getInstance().getOrDefault("instance1", new SupervisordProperties()));
//    }
//
//    @Bean("instance2")
//    @ConditionalOnProperty(prefix = "supervisord.instance.instance2", value = "enable", matchIfMissing = true, havingValue = "true")
//    public Supervisord instance2() {
//        return new SupervisordRpc(instanceProperties.getInstance().getOrDefault("instance2", new SupervisordProperties()));
//    }
//
//    @Bean("instance3")
//    @ConditionalOnProperty(prefix = "supervisord.instance.instance3", value = "enable", matchIfMissing = true, havingValue = "true")
//    public Supervisord instance3() {
//        return new SupervisordRpc(instanceProperties.getInstance().getOrDefault("instance3", new SupervisordProperties()));
//    }
//
//    @Bean("instance4")
//    @ConditionalOnProperty(prefix = "supervisord.instance.instance4", value = "enable", matchIfMissing = true, havingValue = "true")
//    public Supervisord instance4() {
//        return new SupervisordRpc(instanceProperties.getInstance().getOrDefault("instance4", new SupervisordProperties()));
//    }
//
//    @Bean("instance5")
//    @ConditionalOnProperty(prefix = "supervisord.instance.instance5", value = "enable", matchIfMissing = true, havingValue = "true")
//    public Supervisord instance5() {
//        return new SupervisordRpc(instanceProperties.getInstance().getOrDefault("instance5", new SupervisordProperties()));
//    }
//}
